package com.nulstudio.sppm.entity;
import java.util.Objects;
public final class Commodity {
    private final int id;
    private final String name, notes;
    private final float wholesalePrice, retailPrice, costPrice;

    public Commodity(int id, String name, String notes, float wholesalePrice, float retailPrice, float costPrice) {
        this.id = id;
        this.name = name;
        this.notes = notes;
        this.wholesalePrice = wholesalePrice;
        this.retailPrice = retailPrice;
        this.costPrice = costPrice;
    }
    public Commodity() {
        this.id = 0;
        this.name = null;
        this.notes = null;
        this.wholesalePrice = 0;
        this.retailPrice = 0;
        this.costPrice = 0;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getNotes() {
        return notes;
    }

    public float getWholesalePrice() {
        return wholesalePrice;
    }

    public float getRetailPrice() {
        return retailPrice;
    }

    public float getCostPrice() {
        return costPrice;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Commodity commodity = (Commodity) o;
        return id == commodity.id && Float.compare(commodity.wholesalePrice, wholesalePrice) == 0 && Float.compare(commodity.retailPrice, retailPrice) == 0 && Float.compare(commodity.costPrice, costPrice) == 0 && Objects.equals(name, commodity.name) && Objects.equals(notes, commodity.notes);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, notes, wholesalePrice, retailPrice, costPrice);
    }
}
